$(function () {
    $("#dv1").html("修改用户：" + localStorage.getItem("update"));
})
function submit(){
    // $("#status").val($("#sta").val());
    /** 员工表单提交 */
    var username = $("#username");
    var status = $("#status");
    var loginname = $("#loginname");
    console.log(status.val());
    var msg = "";
    if ($.trim(username.val()) == ""){
        msg = "姓名不能为空！";
        username.focus();
    }else if ($.trim(loginname.val()) == ""){
        msg = "登录名不能为空！";
        loginname.focus();
    }else if($.trim(loginname.val()).length<6 || $.trim(loginname.val()).length>20){
        msg = "登录名需要大于6位小于20位！";
        loginname.focus();
    }
    if (msg != ""){
        $.ligerDialog.error(msg);
        return false;
    }
    //$("#userForm").submit();
    var oldname = localStorage.getItem("update");

    $.ajax({
        url: '/user/update',
        type: 'post',
        data:{
            "loginname":loginname.val(),
            "status":status.val(),
            "username":username.val(),
            "oldname":oldname
        },
        success:function (){
            alert("成功修改用户："+username.val());
            $('#message').text("修改成功");
            username.val("");
            loginname.val("");
        },
        error:function () {
            alert("修改用户失败，请与管理员联系");
            $('#message').text("修改失败");
        }
    })
}
function reset(){
    var username = $("#username");
    var loginname = $("#loginname");
    username.val("");
    loginname.val("");
}